package powell.nflpredictionproject.database;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import powell.nflpredictionproject.display.ResultPanel;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import powell.nflpredictionproject.display.MainPanel;
import powell.nflpredictionproject.display.UserPanel;

/**
 *
 * @author Joshua Powell
 */
public class InformationFromDB
{
    //Offense stat holders.

    private double awayTotalScore;
    private double awayFirstDown;
    private double awayThirdDown;
    private double awayRushAtt;
    private double awayRushYards;
    private double awayPassAtt;
    private double awayPassComp;
    private double awayPassYards;
    private double awayPassInt;
    private double awayFumbles;
    private double awaySackNum;
    private double awaySackYards;
    private double awayPenYards;
    private double awayTimeOfPoss;
    private double awayPuntAvg;
    private double homeTotalScore;
    private double homeFirstDown;
    private double homeThirdDown;
    private double homeRushAtt;
    private double homeRushYards;
    private double homePassAtt;
    private double homePassComp;
    private double homePassYards;
    private double homePassInt;
    private double homeFumbles;
    private double homeSackNum;
    private double homeSackYards;
    private double homePenYards;
    private double homeTimeOfPoss;
    private double homePuntAvg;
    private double homeTeamTotalPercentage = 5.0;
    private double awayTeamTotalPercentage;
    UserPanel teams = new UserPanel();
    ResultPanel output2;

    public InformationFromDB()
    {
    }

    public void GetStatsPanel(String awayTeam, String homeTeam)
    {
        try
        {
            JLabel awayTotalScoreDesc = new JLabel("Away PPG: " + awayTotalScore);
            awayTotalScoreDesc.setForeground(Color.WHITE);
            JLabel awayFirstDownDesc = new JLabel("Away First Down: " + awayFirstDown);
            awayFirstDownDesc.setForeground(Color.WHITE);
            JLabel awayThirdDownDesc = new JLabel("Away Third Down: " + awayThirdDown);
            awayThirdDownDesc.setForeground(Color.WHITE);
            JLabel awayRushAttDesc = new JLabel("Away Rush Attempts: " + awayRushAtt);
            awayRushAttDesc.setForeground(Color.WHITE);
            JLabel awayRushYardsDesc = new JLabel("Away Rush Yards: " + awayRushYards);
            awayRushYardsDesc.setForeground(Color.WHITE);
            JLabel awayPassAttDesc = new JLabel("Away Pass Attempts: " + awayPassAtt);
            awayPassAttDesc.setForeground(Color.WHITE);
            JLabel awayPassCompDesc = new JLabel("Away Pass Completion: " + awayPassComp);
            awayPassCompDesc.setForeground(Color.WHITE);
            JLabel awayPassYardsDesc = new JLabel("Away Pass Yards: " + awayPassYards);
            awayPassYardsDesc.setForeground(Color.WHITE);
            JLabel awayPassIntDesc = new JLabel("Away Pass Interceptions: " + awayPassInt);
            awayPassIntDesc.setForeground(Color.WHITE);
            JLabel awayFumblesDesc = new JLabel("Away Fumbles: " + awayFumbles);
            awayFumblesDesc.setForeground(Color.WHITE);
            JLabel awaySackNumDesc = new JLabel("Away Sack Number: " + awaySackNum);
            awaySackNumDesc.setForeground(Color.WHITE);
            JLabel awaySackYardsDesc = new JLabel("Away Sack Yards: " + awaySackYards);
            awaySackYardsDesc.setForeground(Color.WHITE);
            JLabel awayPenYardsDesc = new JLabel("Away Penalty Yards: " + awayPenYards);
            awayPenYardsDesc.setForeground(Color.WHITE);
            JLabel awayTimeOfPossDesc = new JLabel("Away Time Of Posession: " + String.valueOf(awayTimeOfPoss).substring(0, 2) + ":" + String.valueOf(awayTimeOfPoss).substring(2, 3) + "0");
            awayTimeOfPossDesc.setForeground(Color.WHITE);
            JLabel awayPuntAvgDesc = new JLabel("Away Punt Avg: " + awayPuntAvg);
            awayPuntAvgDesc.setForeground(Color.WHITE);
            JLabel homeTotalScoreDesc = new JLabel("Home PPG: " + homeTotalScore);
            homeTotalScoreDesc.setForeground(Color.WHITE);
            JLabel homeFirstDownDesc = new JLabel("Home First Down: " + homeFirstDown);
            homeFirstDownDesc.setForeground(Color.WHITE);
            JLabel homeThirdDownDesc = new JLabel("Home Third Down: " + homeThirdDown);
            homeThirdDownDesc.setForeground(Color.WHITE);
            JLabel homeRushAttDesc = new JLabel("Home Rush Attempts: " + homeRushAtt);
            homeRushAttDesc.setForeground(Color.WHITE);
            JLabel homeRushYardsDesc = new JLabel("Home Rush Yards: " + homeRushYards);
            homeRushYardsDesc.setForeground(Color.WHITE);
            JLabel homePassAttDesc = new JLabel("Home Pass Attempts: " + homePassAtt);
            homePassAttDesc.setForeground(Color.WHITE);
            JLabel homePassCompDesc = new JLabel("Home Pass Completion: " + homePassComp);
            homePassCompDesc.setForeground(Color.WHITE);
            JLabel homePassYardsDesc = new JLabel("Home Pass Yards: " + homePassYards);
            homePassYardsDesc.setForeground(Color.WHITE);
            JLabel homePassIntDesc = new JLabel("Home Pass Interceptions: " + homePassInt);
            homePassIntDesc.setForeground(Color.WHITE);
            JLabel homeFumblesDesc = new JLabel("Home Fumbles: " + homeFumbles);
            homeFumblesDesc.setForeground(Color.WHITE);
            JLabel homeSackNumDesc = new JLabel("Home Sack Number: " + homeSackNum);
            homeSackNumDesc.setForeground(Color.WHITE);
            JLabel homeSackYardsDesc = new JLabel("Home Sack Yards: " + homeSackYards);
            homeSackYardsDesc.setForeground(Color.WHITE);
            JLabel homePenYardsDesc = new JLabel("Home Penalty Yards: " + homePenYards);
            homePenYardsDesc.setForeground(Color.WHITE);
            JLabel homeTimeOfPossDesc = new JLabel("Home Time Of Posession: " + String.valueOf(homeTimeOfPoss).substring(0, 2) + ":" + String.valueOf(homeTimeOfPoss).substring(2, 3) + "0");
            homeTimeOfPossDesc.setForeground(Color.WHITE);
            JLabel homePuntAvgDesc = new JLabel("Home Punt Avg: " + homePuntAvg);
            homePuntAvgDesc.setForeground(Color.WHITE);
            JLabel awayTeamDesc = new JLabel("Away Team Statistics ");
            awayTeamDesc.setForeground(Color.WHITE);
            JLabel homeTeamDesc = new JLabel("Home Team Statistics ");
            homeTeamDesc.setForeground(Color.WHITE);
            JLabel away = new JLabel(awayTeam);
            away.setForeground(Color.WHITE);
            away.setFont(new Font("Lucida Calligraphy", Font.BOLD, 18));
            JLabel home = new JLabel(homeTeam);
            home.setForeground(Color.WHITE);
            home.setFont(new Font("Lucida Calligraphy", Font.BOLD, 18));

            JPanel awayStatPanel = new JPanel(new GridLayout(17, 1));
            JPanel spaceTakerPanel = new JPanel();
            JPanel homeStatPanel = new JPanel(new GridLayout(17, 1));

            awayStatPanel.add(away);
            awayStatPanel.add(awayTeamDesc);
            awayStatPanel.add(awayTotalScoreDesc);
            awayStatPanel.add(awayFirstDownDesc);
            awayStatPanel.add(awayThirdDownDesc);
            awayStatPanel.add(awayRushAttDesc);
            awayStatPanel.add(awayRushYardsDesc);
            awayStatPanel.add(awayPassAttDesc);
            awayStatPanel.add(awayPassCompDesc);
            awayStatPanel.add(awayPassYardsDesc);
            awayStatPanel.add(awayPassIntDesc);
            awayStatPanel.add(awayFumblesDesc);
            awayStatPanel.add(awaySackNumDesc);
            awayStatPanel.add(awaySackYardsDesc);
            awayStatPanel.add(awayPenYardsDesc);
            awayStatPanel.add(awayTimeOfPossDesc);
            awayStatPanel.add(awayPuntAvgDesc);
            homeStatPanel.add(home);
            homeStatPanel.add(homeTeamDesc);
            homeStatPanel.add(homeTotalScoreDesc);
            homeStatPanel.add(homeFirstDownDesc);
            homeStatPanel.add(homeThirdDownDesc);
            homeStatPanel.add(homeRushAttDesc);
            homeStatPanel.add(homeRushYardsDesc);
            homeStatPanel.add(homePassAttDesc);
            homeStatPanel.add(homePassCompDesc);
            homeStatPanel.add(homePassYardsDesc);
            homeStatPanel.add(homePassIntDesc);
            homeStatPanel.add(homeFumblesDesc);
            homeStatPanel.add(homeSackNumDesc);
            homeStatPanel.add(homeSackYardsDesc);
            homeStatPanel.add(homePenYardsDesc);
            homeStatPanel.add(homeTimeOfPossDesc);
            homeStatPanel.add(homePuntAvgDesc);

            homeStatPanel.setBackground(Color.BLACK);
            spaceTakerPanel.setBackground(Color.BLACK);
            awayStatPanel.setBackground(Color.BLACK);

            output2.tempPanel.setBackground(Color.BLACK);

            output2.tempPanel.add(awayStatPanel, BorderLayout.WEST);
            output2.tempPanel.add(homeStatPanel, BorderLayout.EAST);
            output2.tempPanel.add(spaceTakerPanel, BorderLayout.CENTER);
        } catch (Exception ex)
        {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "ERROR!", 1);
        }
    }

    public void calculateVictor(String awayTeam, String homeTeam)
    {
        try
        {
            output2 = new ResultPanel();
            
            //This is using stats from the 2012 NFL season.
            
            if (MainPanel.getAnswer() == 0)
            {
                Connection conn = DriverManager.getConnection("jdbc:derby:NFLStatsDatabase");
                Statement stmt1 = conn.createStatement();
                ResultSet value1;

                value1 = stmt1.executeQuery("Select AVG(SCOREOFF) from Stats2012 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayTotalScore = value1.getInt(1);
                }

                value1 = stmt1.executeQuery("Select AVG(FirstDownOff) from Stats2012 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayFirstDown = value1.getInt(1);
                }

                value1.close();

                ResultSet value2 = stmt1.executeQuery("Select AVG(SCOREOFF) from Stats2012 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeTotalScore = value2.getInt(1);
                }

                value2 = stmt1.executeQuery("Select AVG(FirstDownOff) from Stats2012 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeFirstDown = value2.getInt(1);
                }

                value2.close();
            }

            /*
             * This is using stats from the 2013 NFL season. These stats are not
             * the full season just from the halfway point.
             */
            
            if (MainPanel.getAnswer() == 1)
            {
                Connection conn = DriverManager.getConnection("jdbc:derby:NFLStatsDatabase");
                Statement stmt1 = conn.createStatement();
                ResultSet value1;

                //Away team stuff 2013
                
                value1 = stmt1.executeQuery("Select AVG(SCOREOFF) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayTotalScore = value1.getInt(1);
                }

                value1 = stmt1.executeQuery("Select AVG(FirstDownOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayFirstDown = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select ThirdDownPCTOff from Stats2013 Where teamName = '" + awayTeam + "'");

                int count2 = 1;
                
                while (value1.next())
                {
                   
                    awayThirdDown += Integer.parseInt(value1.getString(1).replaceAll("%", "").trim());
                    
                    value1.next();
                    
                    count2++;
                }

                awayThirdDown = awayThirdDown / count2;
                
                value1 = stmt1.executeQuery("Select AVG(RushAttOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayRushAtt = value1.getInt(1);
                }
                
                value1.close();
                
                value1 = stmt1.executeQuery("Select AVG(RushYDSOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayRushYards = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(RushAttOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayRushAtt = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(RushYDSOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayRushYards = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(PassAttOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPassAtt = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(PassCompOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPassComp = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(PassYDSOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPassYards = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(PassIntOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPassInt = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(FumblesOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayFumbles = value1.getInt(1);
                    System.out.println(awayFumbles);
                }
                
                value1 = stmt1.executeQuery("Select AVG(SackNumOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awaySackNum = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(SackYDSOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awaySackYards = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select AVG(PenYDSOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPenYards = value1.getInt(1);
                }
                
                value1 = stmt1.executeQuery("Select TimePOSSOff from Stats2013 Where teamName = '" + awayTeam + "'");

                int count4 = 1;
                
                while (value1.next())
                {
                   
                    awayTimeOfPoss += Integer.parseInt(value1.getString(1).replaceAll(":", "").trim());
                    
                    value1.next();
                    
                    count4++;
                }
                
                awayTimeOfPoss = awayTimeOfPoss / count4;
                
                value1 = stmt1.executeQuery("Select AVG(PuntAVGOff) from Stats2013 Where teamName = '" + awayTeam + "'");

                if (value1.next())
                {
                    awayPuntAvg = value1.getInt(1);
                }
                
                value1.close();

                //Home Team Stuff 2013
                
                ResultSet value2 = stmt1.executeQuery("Select AVG(SCOREOFF) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeTotalScore = value2.getInt(1);
                }

                value2 = stmt1.executeQuery("Select AVG(FirstDownOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeFirstDown = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select ThirdDownPCTOff from Stats2013 Where teamName = '" + homeTeam + "'");

                int count1 = 1;
                
                while (value2.next())
                {
                   
                    homeThirdDown += Integer.parseInt(value2.getString(1).replaceAll("%", "").trim());
                    
                    value2.next();
                    
                    count1++;
                }
                
                homeThirdDown = homeThirdDown / count1;
                
                value2 = stmt1.executeQuery("Select AVG(RushAttOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeRushAtt = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(RushYDSOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeRushYards = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(PassAttOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePassAtt = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(PassCompOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePassComp = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(PassYDSOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePassYards = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(PassIntOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePassInt = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(FumblesOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeFumbles = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(SackNumOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeSackNum = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(SackYDSOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homeSackYards = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select AVG(PenYDSOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePenYards = value2.getInt(1);
                }
                
                value2 = stmt1.executeQuery("Select TimePOSSOff from Stats2013 Where teamName = '" + homeTeam + "'");

                int count3 = 1;
                
                while (value2.next())
                {
                   
                    homeTimeOfPoss += Integer.parseInt(value2.getString(1).replaceAll(":", "").trim());
                    
                    value2.next();
                    
                    count3++;
                }
                
                homeTimeOfPoss = homeTimeOfPoss / count3;
                
                value2 = stmt1.executeQuery("Select AVG(PuntAVGOff) from Stats2013 Where teamName = '" + homeTeam + "'");

                if (value2.next())
                {
                    homePuntAvg = value2.getInt(1);
                }
                
                value2.close();
            }

            if (awayTotalScore < homeTotalScore)
            {
                homeTeamTotalPercentage += 15;
            }

            if (awayTotalScore > homeTotalScore)
            {
                awayTeamTotalPercentage += 15;
            }

            if (awayFirstDown < homeFirstDown)
            {
                homeTeamTotalPercentage += 5;
            }

            if (awayFirstDown > homeFirstDown)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awayThirdDown > homeThirdDown)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awayThirdDown < homeThirdDown)
            {
                homeTeamTotalPercentage += 5;
            }
            
            if (awayRushYards / awayRushAtt > homeRushYards / homeRushAtt)
            {
                awayTeamTotalPercentage += 10;
            }
            
            if (awayRushYards / awayRushAtt < homeRushYards / homeRushAtt)
            {
                homeTeamTotalPercentage += 10;
            }
            
            if (awayPassYards / awayPassAtt > homePassYards / homePassAtt)
            {
                awayTeamTotalPercentage += 10;
            }
            
            if (awayPassYards / awayPassAtt < homePassYards / homePassAtt)
            {
                homeTeamTotalPercentage += 10;
            }
            
            if (awayPassComp > homePassComp)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awayPassComp < homePassComp)
            {
                homeTeamTotalPercentage += 5;
            }
            
            if (awayPassInt > homePassInt)
            {
                awayTeamTotalPercentage -= 5;
            }
            
            if (awayPassInt < homePassInt)
            {
                homeTeamTotalPercentage -= 5;
            }
            
            if (awayFumbles > homeFumbles)
            {
                awayTeamTotalPercentage -= 5;
            }
            
            if (awayFumbles < homeFumbles)
            {
                homeTeamTotalPercentage -= 5;
            }
            
            if (awaySackNum > homeSackNum)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awaySackNum < homeSackNum)
            {
                homeTeamTotalPercentage += 5;
            }
            
            if (awaySackYards > homeSackYards)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awaySackYards < homeSackYards)
            {
                homeTeamTotalPercentage += 5;
            }
            
            if (awayPenYards > homePenYards)
            {
                awayTeamTotalPercentage -= 5;
            }
            
            if (awayPenYards < homePenYards)
            {
                homeTeamTotalPercentage -= 5;
            }
            
            if (awayTimeOfPoss > homeTimeOfPoss)
            {
                awayTeamTotalPercentage += 10;
            }
            
            if (awayTimeOfPoss < homeTimeOfPoss)
            {
                homeTeamTotalPercentage += 10;
            }
            
            if (awayPuntAvg > homePuntAvg)
            {
                awayTeamTotalPercentage += 5;
            }
            
            if (awayPuntAvg < homePuntAvg)
            {
                homeTeamTotalPercentage += 5;
            }
            

            if (awayTeamTotalPercentage < homeTeamTotalPercentage)
            {
                if (MainPanel.getAnswer() == 0)
                {
                output2.setOutputText("The " + homeTeam + " won the game against the " + awayTeam + " using the 2012 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
                
                if (MainPanel.getAnswer() == 1)
                {
                output2.setOutputText("The " + homeTeam + " won the game against the " + awayTeam + " using the 2013 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
            }

            if (awayTeamTotalPercentage > homeTeamTotalPercentage)
            {
                if (MainPanel.getAnswer() == 0)
                {
                output2.setOutputText("The " + awayTeam + " won the game against the " + homeTeam + " using the 2012 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
                
                if (MainPanel.getAnswer() == 1)
                {
                output2.setOutputText("The " + awayTeam + " won the game against the " + homeTeam + " using the 2013 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
            }
            
            if (awayTeamTotalPercentage == homeTeamTotalPercentage)
            {
                if (MainPanel.getAnswer() == 0)
                {
                output2.setOutputText("This game is a tie using the 2012 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
                
                if (MainPanel.getAnswer() == 1)
                {
                output2.setOutputText("This game is a tie using the 2013 NFL Stats.");
                System.out.println(awayTeamTotalPercentage);
                System.out.println(homeTeamTotalPercentage);
                }
            }

            GetStatsPanel(awayTeam, homeTeam);
        } catch (Exception ex)
        {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "ERROR!", 1);
        }

    }
    /**
     * @return the tempPanel
     */
}
